{namespace be = TYPO3\CMS\Backend\ViewHelpers}
{namespace bu = TYPO3\CMS\Beuser\ViewHelpers}
{namespace core = TYPO3\CMS\Core\ViewHelpers}

<f:layout name="Default" />

<f:section name="headline">
	<h1><f:translate key="backendUserListing" /></h1>
</f:section>

<f:section name="content">

	<f:comment>
		Listing of users on compare list
	</f:comment>
	<f:if condition="{compareUserList}">
		<h3>{f:translate(key: 'section.compare', default: 'Compare')}</h3>
		<div class="table-fit">
			<table class="table table-hover">
				<tbody>
					<f:for each="{compareUserList}" as="compareUser">
						<tr>
							<td>
								<a href="#" class="t3-js-clickmenutrigger" data-table="be_users" data-uid="{compareUser.uid}" data-listframe="1" title="id={compareUser.uid}">
									<be:avatar backendUser="{compareUser.uid}" showIcon="TRUE" />
								</a>
							</td>
							<td class="col-title">
								{compareUser.userName}
							</td>
							<td>
								<f:link.action action="removeFromCompareList" arguments="{uid: compareUser.uid}" class="pull-right btn btn-default">
									<core:icon identifier="actions-selection-delete" />
								</f:link.action>
							</td>
						</tr>
					</f:for>
				</tbody>
			</table>
		</div>
		<f:form action="compare">
			<f:form.submit value="{f:translate(key: 'compareUserList', default: 'Compare user list')}" class="btn btn-default" />
		</f:form>
		<hr>
	</f:if>

	<f:comment>
		Filter section
	</f:comment>
	<f:render partial="Filters/BackendUser/Index" arguments="{demand: demand, backendUserGroups: backendUserGroups}" />

	<f:comment>
		Listing of all users
	</f:comment>
	<f:be.widget.paginate objects="{backendUsers}" as="paginatedBackendUsers" configuration="{itemsPerPage: 50, insertBelow: 1}">
		<div class="table-fit">
			<table class="table table-striped table-hover">
				<thead>
					<tr>
						<th></th>
						<th class="col-title"><f:translate key="userName" /> / <f:translate key="realName" /></th>
						<th><f:translate key="lastLogin" /></th>
						<th class="col-control"></th>
					</tr>
				</thead>
				<tbody>
					<f:for each="{paginatedBackendUsers}" as="backendUser">
						<f:render partial="BackendUser/IndexListRow" arguments="{demand: demand, backendUser: backendUser, onlineBackendUsers: onlineBackendUsers, dateFormat: dateFormat, timeFormat: timeFormat, returnUrl: returnUrl}" />
					</f:for>
					<f:comment>
						Footer row: no officially defined style yet
					</f:comment>
					<tr>
						<td colspan="5">
							<f:count subject="{backendUsers}" /> <f:translate key="users" />
						</td>
					</tr>
				</tbody>
			</table>
		</div>
	</f:be.widget.paginate>

</f:section>
